package com.springboot;

import com.springboot.Thread.AsyncTaskService;
import com.springboot.Thread.TaskExecutorConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@SpringBootApplication
public class MutilThreadApplication {

	public static void main(String[] args) {

		SpringApplication.run(MutilThreadApplication.class, args);
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TaskExecutorConfig.class);
		AsyncTaskService async = context.getBean(AsyncTaskService.class);
		for (int i = 0; i < 10 ; i++) {
			async.executeAsyncTask(i);
			async.executeAsyncTaskPlus(i);
		}
		context.close();
	}
}
